<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />


    <title>产品详细内容页</title>
</head>

<body>
{layout name="layout1" /}
<!--内容样式-->
<div id="page">
    <!--位置-->
    <div class="Position">当前位置：<a href="#">首页</a> > <a  href="#">产品列表</a></div>
    <!--详细内容-->
    <div class="detailed">
        <div class="showContent margin clearfix">
            <!--相册样式-->
            <div class="gallery">
                <div class="content_style">
                    <div class="Show_style">
                        <div id="play">
                            <ul class="img_ul" id="detail">
                                <li class="jqzoom_pm"><a class="img_a"><img src="{$coInfo.image}" style="height: 500px;"></a></li>
                                <li class="jqzoom_pm"><a class="img_a"><img src="{$coInfo.image2}" style="height: 500px;"></a></li>
                                <li class="jqzoom_pm"><a class="img_a"><img src="{$coInfo.image3}" style="height: 500px;"></a></li>
                                <li class="jqzoom_pm"><a class="img_a"><img src="{$coInfo.image4}" style="height: 500px;"></a></li>
                            </ul>
                            <a href="javascript:void(0)" class="prev_a change_a" title="上一张"><span style="display: none;"></span></a>
                            <a href="javascript:void(0)" class="next_a change_a" title="下一张"><span style="display: none;"></span></a>
                        </div>
                        <div class="img_hd">
                            <ul class="clearfix xiaotu">
                                <li class=""><a class="img_a"><img src="{$coInfo.image}" onload="imgs_load(this)"></a></li>
                                <li class=""><a class="img_a"><img src="{$coInfo.image2}" onload="imgs_load(this)"></a></li>
                                <li class=""><a class="img_a"><img src="{$coInfo.image3}" onload="imgs_load(this)"></a></li>
                                <li class=""><a class="img_a"><img src="{$coInfo.image4}" onload="imgs_load(this)"></a></li>
                            </ul>
                            <a class="bottom_a prev_a" style="opacity: 0.7;">&lt;</a>
                            <a class="bottom_a next_a" style="opacity: 0.7;">&gt;</a>
                        </div>
                    </div>
                </div>
            </div>
            <!--购买样式-->
            <div class="p_right_style">
                <div class="title_name"><h1>{$coInfo.name}</h1><p class="p_ad">{$coInfo.details}</p></div>
                <div id="summary">
                    <div class="p_Price">
                        <div class="dt">价&nbsp;&nbsp;&nbsp;格:</div>
                        <div class="dd"><strong class="p_dd_price" id="xs-price">{$coInfo.price}</strong></div>
                        <div class="Comment"><p>累计评论</p><h6 ><a href="#">33</a></h6></div>
                    </div>
                    <div class="Sort">

                        <dl><dt class="name">库&nbsp;&nbsp;&nbsp;存:</dt><dd class="">{$coInfo.stock}</dd></dl>

                        </ul>
                    </div>
                    <div class="p_Submit">
                        <div class="Numbers">

                            <input id="number" name="num" type="text" value="1" class="number_text">

                        </div>
                        <div class="btn_Submit">
                            <a href="javascript:addToCart_bak({$coInfo.id})" class="wrap_btn1" title="加入购物车"></a>
                            <a href="javascript:addToBuy({$coInfo.id})"  class="wrap_btn2" title="立即购买"></a>
                        </div>
                    </div>
                    <div class="ProductD clearfix">

                    </div>
                </div>
            </div>
        </div>
        <div class="Show_style">
            <div class="left_style">

                <!--记录-->
                <div class="Record">
                    <div class="title_name">热销产品</div>
                    <ul>
                        {volist name="info" as id="vvv"}

                        <li>
                            <a href="#">
                                <P><img src="{$vvv.image}" /></P>
                                <p>商品名称</p>
                            </a>
                            <p>价格:<b>￥ {$vvv.price}</b></p>
                        </li>
                        {/volist}
                    </ul>
                </div>
            </div>
            <!--右侧样式-->
            <div class="right_style">
                <div class="fixed_bar">
                    <ul>
                        <li class="on"><a href="#">产品介绍</a></li>
                        <li><a href="#">商品评论(<b>0</b>)</a></li>
                        <li><a href="#">售后保障</a></li>
                    </ul>
                </div>
                <div class="sh_Service">
                    <div class="title_name">售后保障</div>
                    <div class="content">
                        <ul>
                            <li><img src="/static/common/images/fu_img_03.png" /></li>
                            <li><img src="/static/common/images/fu_img_05.png" /></li>
                            <li><img src="/static/common/images/fu_img_07.png" /></li>
                            <li><img src="/static/common/images/fu_img_09.png" /></li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!--底部样式-->
    <div class="slogen">
        <p><img src="/static/common/images/fuwu_56.png" /></p>
        <p><img src="/static/common/images/fuwu_57.png" /></p>
        <p><img src="/static/common/images/fuwu_58.png" /></p>
        <p><img src="/static/common/images/fuwu_59.png" /></p>
    </div>

</div>
</div>
<div id="bottom">
    <div class="footers">
        <div class="logo"></div>
        <div class="footer_link">


        </div>
    </div>
</div>

</body>
</html>
<script type="text/javascript">
    var i=0; //图片标识
    var img_num=$(".img_ul").children("li").length; //图片个数
    $(".img_ul li").hide(); //初始化图片
    play();
    $(function(){
        $(".img_hd ul").css("width",($(".img_hd ul li").outerWidth(true))*img_num); //设置ul的长度

        $(".bottom_a").css("opacity",0.7);	//初始化底部a透明度
        //$("#play").css("height",$("#play .img_ul").height());
        if (!window.XMLHttpRequest) {
                $(".change_a").css("height",$(".change_a").parent().height());
                }

            $(".change_a").focus(function(){
                this.blur();
            });
        $(".bottom_a").hover(function(){
                $(this).css("opacity",1);
                },function(){
                $(this).css("opacity",0.7);
            });

        $(".change_a").hover(function(){
                $(this).children("span").show();
                },function(){
                $(this).children("span").hide();
            });

        $(".img_hd ul li").click(function(){
            i=$(this).index();
            play();
        });

        $(".prev_a").click(function(){
            //i+=img_num;
            i--;
            //i=i%img_num;
            i=(i<0?0:i);
            play();
        });
        $(".next_a").click(function(){
            i++;
            //i=i%img_num;
            i=(i>(img_num-1)?(img_num-1):i);
            play();
        });
    });

    function play(){
            var img=new Image();
            img.onload=function(){
            img_load(img,$(".img_ul").children("li").eq(i).find("img"))
            };
    img.src=$(".img_ul").children("li").eq(i).find("img").attr("src");
    //$(".img_ul").children("li").eq(i).find("img").(img_load($(".img_ul").children("li").eq(i).find("img")));
    $(".img_hd ul").children("li").eq(i).addClass("on").siblings().removeClass("on");
    if(img_num>7){
            if(i<img_num-3){ //前3个
            $(".img_hd ul").animate({"marginLeft":(-($(".img_hd ul li").outerWidth()+4)*(i-3<0?0:(i-3)))});
    }else if(i>=img_num-3){
            $(".img_hd ul").animate({"marginLeft":(-($(".img_hd ul li").outerWidth()+4)*(img_num-7))});
    }
    }
    if(!window.XMLHttpRequest){
            $(".change_a").css("height",$(".change_a").parent().height());
            }
        }

    function img_load(img_id,now_imgid){
    if(img_id.width/img_id.height>1){
    if(img_id.width >=$("#play").width())
    $(now_imgid).width($("#play").width());
    }else{
        if(img_id.height>=500) $(now_imgid).height(500);
    }
    $(".img_ul").children("li").eq(i).show().siblings("li").hide(); //大小确定后进行显示
    }

    function imgs_load(img_id){
            if(img_id.width >=$(".img_hd ul li").width()){img_id.width = 80};
    //if(img_id.height>=$(".img_hd ul li").height()) {img_id.height=$(".img_hd ul li").height();}
    }
    function addToCart_bak(coid) {
        var num = $('#number').val();
        $.ajax({
            type:"post",
            url:"{:url('home/commodity/cart')}",
            dataType: 'json',
            data:{coid:coid, num:num},
            success:function (data) {
                if(data.status == -1){
                    layer.msg(data.msg,{icon:2,time:1000});
                }else{
                    layer.msg(data.msg,{icon:1,time:1000});
                    window.location.reload();
                }
            }
        })
    }
    function addToBuy(coid) {
        var num = $('#number').val();
        window.location.href = '{:url('home/commodity/order')}'+'?coid='+ coid + '&num='+ num;
    }
</script>